/////////////////////////////////////////////////////////////////////////////////////
// Include Files
#include "Blockade.h"

//#include "IE\Main.h"
//#include "IE\Scene.h"
//
//#include "Sky.h"
//#include "Galleon.h"
//#include "Water.h"
//
//#include "Render\RenderState.h"

/////////////////////////////////////////////////////////////////////////////////////
// CBlockade Implementation

CBlockade::CBlockade() : CScriptNode()//, m_pScene(_pScene)
{
	//// TODO: this is a loading group: all assets I need for the 'Blockade' scene
	//m_pScene->LoadMesh(L"..\\Blockade\\Meshes\\Galleon.mesh");
	//m_pScene->LoadMesh(L"..\\Blockade\\Meshes\\Sky.mesh");
	//m_pScene->LoadMesh(L"..\\Blockade\\Meshes\\Water.mesh");
	//m_pScene->LoadShader(L"..\\Blockade\\Shaders\\Galleon.shader");
	//m_pScene->LoadShader(L"..\\Blockade\\Shaders\\Sky.shader");
	//m_pScene->LoadShader(L"..\\Blockade\\Shaders\\Water.shader");
	//m_pScene->LoadTexture(L"..\\Blockade\\Textures\\Lake.texcube");
	//m_pScene->LoadTexture(L"..\\Blockade\\Textures\\WaterBase.tex2d");
	//m_pScene->LoadTexture(L"..\\Blockade\\Textures\\WaterTop.tex2d");

	//// set up the sky
	//m_pSky = IE::CreateObject(m_pScene);

	//CScriptState *pSkyScript = new CSky();
	//m_pSky->SetScriptState(pSkyScript);

	//matrix_t matSky = Matrix();

	//CRenderState * pSkyRender = new CRenderState();
	//pSkyRender->SetMesh(L"..\\Blockade\\Meshes\\Sky.mesh");
	//pSkyRender->SetShader(L"..\\Blockade\\Shaders\\Sky.shader");
	//pSkyRender->SetTransform(matSky);
	//pSkyRender->SetMatrixParam(L"g_matModelViewProj", PARAM_MAT_MODELVIEWPROJ_ROT);
	//pSkyRender->AddTexParam(L"..\\Blockade\\Textures\\Lake.texcube", L"SkySampler");
	//m_pSky->SetRenderState(pSkyRender);

	//// set up the galleon
	//m_pGalleon = IE::CreateObject(m_pScene);

	//CScriptState *pGalleonScript = new CGalleon();
	//m_pGalleon->SetScriptState(pGalleonScript);

	//matrix_t matGalleon = Matrix();
	//matGalleon = MatrixMul( MatrixTranslation(0.0f, 12.0f, 0.0f), matGalleon );
	//matGalleon = MatrixMul( MatrixRotationX(CE_PI_DIV_2), matGalleon );

	//CRenderState *pGalleonRender = new CRenderState();
	//pGalleonRender->SetMesh(L"..\\Blockade\\Meshes\\Galleon.mesh");
	//pGalleonRender->SetShader(L"..\\Blockade\\Shaders\\Galleon.shader");
	//pGalleonRender->SetMatrixParam(L"g_matModelView", PARAM_MAT_MODELVIEW);
	//pGalleonRender->SetMatrixParam(L"g_matModelViewProj", PARAM_MAT_MODELVIEWPROJ);
	//pGalleonRender->SetTransform(matGalleon);
	//m_pGalleon->SetRenderState(pGalleonRender);

	//// set up the water
	//m_pWater = IE::CreateObject(m_pScene);

	//CScriptState *pWaterScript = new CWater();
	//m_pWater->SetScriptState(pWaterScript);

	//matrix_t matWater = Matrix();

	//CRenderState *pWaterRender = new CRenderState();
	//pWaterRender->SetMesh(L"..\\Blockade\\Meshes\\Water.mesh");
	//pWaterRender->SetShader(L"..\\Blockade\\Shaders\\Water.shader");
	//pWaterRender->SetTransform(matWater);
	//pWaterRender->SetMatrixParam(L"g_matModelView", PARAM_MAT_MODELVIEW);
	//pWaterRender->SetMatrixParam(L"g_matModelViewProj", PARAM_MAT_MODELVIEWPROJ);
	//pWaterRender->AddTexParam(L"..\\Blockade\\Textures\\WaterBase.tex2d", L"Water1Sampler");
	//pWaterRender->AddTexParam(L"..\\Blockade\\Textures\\WaterTop.tex2d", L"Water2Sampler");
	//m_pWater->SetRenderState(pWaterRender);
}

CBlockade::~CBlockade()
{
	//IE::DestroyObject(m_pWater);
	//IE::DestroyObject(m_pGalleon);
	//IE::DestroyObject(m_pSky);

	//RemoveEventListener(ABCScene::Load, &CBlockade::OnLoad);
	//RemoveEventListener(ABCScene::Destroy, &CBlockade::OnDestroy);
}

//void CBlockade::OnLoad( CEventArg &_rArg )
//{
//}
//
//void CBlockade::OnDestroy( CEventArg &_rArg )
//{
//	//delete m_pSky;
//	//delete m_pGalleon;
//	//delete m_pWater;
//}
